import axios from 'axios';
import $ from 'jquery'
axios.defaults.headers['Content-type'] ='application/x-www-form-urlencoded;charset=UTF-8';
axios.defaults.withCredentials=true;
export default axios;
let base = 'http://www.zcxy360.com/sandtable';
if (document.domain.indexOf('.zcxy360.com') == -1) {
    if(document.domain.indexOf('.72.180') == -1){
    	base = "http://192.168.72.154:8081";
    }else{
    	base = "http://192.168.72.180:8081";    	
    }
}
export const requestLogins=function(name,pass,callback){
	$.ajax({
		type:"post",
		url:base+'/user/login',
		data:{
			username:name,
			password:pass
		},
		async:true,
		success:function(r){
			typeof callback == 'function' && callback.call(this, r);
		}
	});
}
export const OrgTypelist = params => { return axios.get(`${base}/common/listOrgType`,{params:params}).then(res => res.data)};
//机构类型列表查询
//登录接口
export const requestLogin = params => { return axios.post(`${base}/user/login`,params).then(res => res.data);};
export const passwordrule = params => { return axios.get(`${base}/user/checkPassword`,{params:params}).then(res => res.data);};
export const resetPassword = params => { return axios.get(`${base}/user/resetPassword`,{params:params}).then(res => res.data);};
//用户信息
export const requestinfo = params => { return axios.get(`${base}/user/getBySession`,params).then(res => res.data);};
//用户退出
export const requestquit= params => { return axios.get(`${base}/user/logout`,params).then(res => res.data);};
//新建用户
export const userlist = params => { return axios.get(`${base}/user`,{params:params}).then(res => res.data);};
//用户列表查询
export const userone = params => { return axios.get(`${base}/user/`+params).then(res => res.data);};
//用户单个查询
export const userdelete = params => { return axios.delete(`${base}/user/`+params).then(res => res.data);};
//用户删除
export const useradd = params => { return axios.post(`${base}/user`,params).then(res => res.data);};
//用户添加
export const usermoreadd = params => { return axios.post(`${base}/user/import`,params).then(res => res.data);};
//用户批量倒入
export const useredit = params => { return axios.put(`${base}/user`,params).then(res => res.data);};
//用户更新
export const usernamerule = params => { return axios.get(`${base}/user/checkUnique`,{params:params}).then(res => res.data);};
//用户名称验证
export const orglist = params => { return axios.get(`${base}/org`,{params:params}).then(res => res.data);};
//机构列表查询
export const orgone = params => { return axios.get(`${base}/org/`+params).then(res => res.data);};
//机构单个查询
export const orgdelete = params => { return axios.delete(`${base}/org/`+params).then(res => res.data);};
//机构删除
export const orgadd = params => { return axios.post(`${base}/org`,params).then(res => res.data);};
//机构添加
export const orgedit = params => { return axios.put(`${base}/org`,params).then(res => res.data);};
//机构更新
export const orgnamerule = params => { return axios.get(`${base}/org/checkName`,{params:params}).then(res => res.data);};
//机构名称验证
export const bussinesslist = params => { return axios.get(`${base}/common/listBusinessModel`,{params:params}).then(res => res.data);};
//商业模式查询
export const videolist = params => { return axios.get(`${base}/video`,{params:params}).then(res => res.data);};
//视频列表查询
export const videolistbuil = params => { return axios.get(`${base}/video/builtin`,{params:params}).then(res => res.data);};
//内置视频列表查询
export const videoone = params => { return axios.get(`${base}/video/`+params).then(res => res.data);};
//视频单个查询
export const videodelete = params => { return axios.delete(`${base}/video/`+params).then(res => res.data);};
//视频删除
export const videoadd = params => { return axios.post(`${base}/video`,params).then(res => res.data);};
//视频添加
export const videoedit = params => { return axios.put(`${base}/video`,params).then(res => res.data);};
//视频更新
export const videonamerule = params => { return axios.get(`${base}/video/checkName`,{params:params}).then(res => res.data);};
//视频名称验证
export const worklist = params => { return axios.get(`${base}/problem`,{params:params}).then(res => res.data);};
//试题列表查询
export const worklistbuil = params => { return axios.get(`${base}/problem/builtin`,{params:params}).then(res => res.data);};
//内置试题列表查询
export const workone = params => { return axios.get(`${base}/problem/`+params).then(res => res.data);};
//试题单个查询
export const workdelete = params => { return axios.delete(`${base}/problem/`+params).then(res => res.data);};
//试题删除
export const workadd = params => { return axios.post(`${base}/problem`,params).then(res => res.data);};
//试题添加
export const workedit = params => { return axios.put(`${base}/problem`,params).then(res => res.data);};
//试题更新
export const worknamerule = params => { return axios.get(`${base}/problem/checkName`,{params:params}).then(res => res.data);};
//试题名称验证
export const planlist = params => { return axios.get(`${base}/plan`,{params:params}).then(res => res.data);};
//教案列表查询
export const planlistbuil = params => { return axios.get(`${base}/plan/builtin`,{params:params}).then(res => res.data);};
//内置教案列表查询
export const planone = params => { return axios.get(`${base}/plan/`+params).then(res => res.data);};
//教案单个查询
export const plandelete = params => { return axios.delete(`${base}/plan/`+params).then(res => res.data);};
//教案删除
export const planadd = params => { return axios.post(`${base}/plan`,params).then(res => res.data);};
//教案添加
export const planedit = params => { return axios.put(`${base}/plan`,params).then(res => res.data);};
//教案更新
export const plannamerule = params => { return axios.get(`${base}/plan/checkName`,{params:params}).then(res => res.data);};
//教案名称验证
export const drawlist = params => { return axios.get(`${base}/drawing`,{params:params}).then(res => res.data);};
//图纸列表查询
export const drawlistbuil = params => { return axios.get(`${base}/drawing/builtin`,{params:params}).then(res => res.data);};
//内置图纸列表查询
export const drawone = params => { return axios.get(`${base}/drawing/`+params).then(res => res.data);};
//图纸单个查询
export const drawdelete = params => { return axios.delete(`${base}/drawing/`+params).then(res => res.data);};
//图纸删除
export const drawadd = params => { return axios.post(`${base}/drawing`,params).then(res => res.data);};
//图纸添加
export const drawedit = params => { return axios.put(`${base}/drawing`,params).then(res => res.data);};
//图纸更新
export const drawnamerule = params => { return axios.get(`${base}/drawing/checkName`,{params:params}).then(res => res.data);};
//图纸名称验证
export const templetlist = params => { return axios.get(`${base}/templet`,{params:params}).then(res => res.data);};
//课程小节列表查询
export const templetlistbuil = params => { return axios.get(`${base}/templet/builtin`,{params:params}).then(res => res.data);};
//课程小节内置列表查询
export const templetone = params => { return axios.get(`${base}/templet/`+params).then(res => res.data);};
//课程小节单个查询
export const templetdelete = params => { return axios.delete(`${base}/templet/`+params).then(res => res.data);};
//课程小节删除
export const templetadd = params => { return axios.post(`${base}/templet`,params).then(res => res.data);};
//课程小节添加
export const templetedit = params => { return axios.put(`${base}/templet`,params).then(res => res.data);};
//课程小节更新
export const templetnamerule = params => { return axios.get(`${base}/templet/checkName`,{params:params}).then(res => res.data);};
//课程小节名称验证

//课程创建
export const courseadd = params => { return axios.post(`${base}/course`,params).then(res => res.data);};
export const courselist = params => { return axios.get(`${base}/course`,{params:params}).then(res => res.data);};
export const courseedit = params => { return axios.put(`${base}/course`,params).then(res => res.data);};
export const courseend = params => { return axios.put(`${base}/course/end`,params).then(res => res.data);};
export const courseone = params => { return axios.get(`${base}/course/`+params).then(res => res.data);};
export const coursedelete = params => { return axios.delete(`${base}/course/`+params).then(res => res.data);};
//课程单元模块儿
export const coursecalender = params => { return axios.get(`${base}/course/calendar`,{params:params}).then(res => res.data);};
export const coursenamerule = params => { return axios.get(`${base}/course/checkName`,{params:params}).then(res => res.data);};
export const coursstage= params => { return axios.put(`${base}/course/stage`,params).then(res => res.data);};
export const coursgetstage= params => { return axios.get(`${base}/course/stage/`+params).then(res => res.data);};
export const coursunitedit = params => { return axios.put(`${base}/course/stage/unit`,params).then(res => res.data);};
export const coursunitadd = params => { return axios.post(`${base}/course/stage/unit`,params).then(res => res.data);};
export const coursunitdelete = params => { return axios.delete(`${base}/course/stage/unit/`+params).then(res => res.data);};
export const coursunitsortedit = params => { return axios.put(`${base}/course/stage/unit/sort`,params).then(res => res.data);};
export const coursunitget = params => { return axios.get(`${base}/course/stage/unit/`+params).then(res => res.data);};
//学生进入课程
export const coursejoin = params => { return axios.get(`${base}/course/join`,{params:params}).then(res => res.data);};
export const coursestudentjoin= params => { return axios.post(`${base}/course/student/join`,params).then(res => res.data);};
export const coursecopy = params => { return axios.post(`${base}/course/clone`,params).then(res => res.data);};
//更新学生排座位
export const coursestuseat= params => { return axios.put(`${base}/course/student`,params).then(res => res.data);};
//课程学生查询
export const courseStudent = params => { return axios.get(`${base}/course/student`,{params:params}).then(res => res.data);};
export const courseStudentSelf = params => { return axios.get(`${base}/course/student/`+params,).then(res => res.data);};
export const courseStudentedit = params => { return axios.put(`${base}/course/student`,params).then(res => res.data);};
export const courseStudentdelete = params => { return axios.delete(`${base}/course/student/`+params).then(res => res.data);};
export const courseTeam = params => { return axios.get(`${base}/course/team`,{params:params}).then(res => res.data);};
export const courseTeamedit = params => { return axios.put(`${base}/course/team`,params).then(res => res.data);};
export const courseTeamSelf = params => { return axios.get(`${base}/course/team/`+params,).then(res => res.data);};
export const courseTeammark = params => { return axios.put(`${base}/course/team/mark`,params).then(res => res.data);};
export const courseTeamback= params => { return axios.put(`${base}/course/team/back`,params).then(res => res.data);};
export const coursestudentmark = params => { return axios.put(`${base}/course/student/mark`,params).then(res => res.data);};
export const courseReturn = params => { return axios.put(`${base}/course/student/unit/back`,params).then(res => res.data);};
//学生课程
export const courseStuself = params => { return axios.get(`${base}/course/study`,{params:params}).then(res => res.data);};
export const courseStucontent = params => { return axios.get(`${base}/course/student/unit/listWithStageUnitCascade`,{params:params}).then(res => res.data);}
export const courseStuedit = params => { return axios.put(`${base}/course/student/unit`,params).then(res => res.data);};
export const courseWorkput = params => { return axios.put(`${base}/course/student/unit/submit`,params).then(res => res.data);};
export const courseGetworkself = params => { return axios.get(`${base}/course/student/unit/problem`,{params:params}).then(res => res.data);};
export const courseTuiput = params => { return axios.post(`${base}/course/team/inferSubmit`,params).then(res => res.data);};
export const courseRoadput = params => { return axios.post(`${base}/course/team/roadSubmit`,params).then(res => res.data);};
export const coursestartInfer = params => { return axios.put(`${base}/course/stage/startTeamStage`,params).then(res => res.data);};
export const courseTaskput = params => { return axios.put(`${base}/course/student/unit/mark`,params).then(res => res.data);};
export const scheduleVido = params => { return axios.put(`${base}/course/student/unit/useVideo`,params).then(res => res.data);};
export const schedulePlan = params => { return axios.put(`${base}/course/student/unit/usePlan`,params).then(res => res.data)};
export const scheduleDraw = params => { return axios.put(`${base}/course/student/unit/useDrawing`,params).then(res => res.data)};
//学生成绩
export const courseStuchieven = params => { return axios.get(`${base}/course/student/getForCompletion`,{params:params}).then(res => res.data)}
//作业批改
export const courseStupi = params => { return axios.get(`${base}/course/student/unit/listWithCascade`,{params:params}).then(res => res.data);}
//图纸历史版本
export const drawHistrory = params => { return axios.get(`${base}/course/team/teamDrawingHistory`,{params:params}).then(res => res.data);}
export const drawHistroryone = params => { return axios.get(`${base}/course/team/teamDrawingHistory/getLastHistory`,{params:params}).then(res => res.data);}
export const drawHistroryPost = params => { return axios.post(`${base}/course/team/teamDrawingHistory`,params).then(res => res.data);};
export const rulepass = params => { return axios.get(`${base}/common/checkCode`,{params:params}).then(res => res.data);};
export const sendCode = params => { return axios.get(`${base}/common/sendCode`,{params:params}).then(res => res.data);};

